﻿<!-- TODO:
        Script, changing droplist "filterOptions" dropDownList, depending on selected "FilterType" -->
@model IEnumerable<OrderSystem.Models.Orders>
@{
    WebGrid ordersGrid = new WebGrid(Model, canPage: true, canSort: true, rowsPerPage: 10);
}

<h4>@Html.ActionLink("Create New Order","Create")</h4>

@using (Html.BeginForm())
{
<fieldset>
<table>
    <tr>
        <td>
            <p>Filter Orders By:</p>
        </td>
        <td>
            <select id="FilterType" name="FilterType">
                <option>Status</option>
                <option>Role</option>
            </select>
        </td>
        <td>
            <select id="StatusOptions" name="StatusOptions">
                <option>None</option>
                <option>Ordered</option>
                <option>Pending</option>
                <option>Delivered</option>
            </select>
        </td>
        <td>
            <select id="RoleOptions" name="RoleOptions">
                <option>Merchandiser</option>
                <option>Administrator</option>
                <option>Supervisor</option>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <p>Search for Orders By:</p>
        </td>
        <td>
            <select id="SearchType" name="SearchType">
                <option>Order Name</option>
                <option>Status</option>
                <option>Assignee</option>
            </select>
        </td>
        <td>
           <input id="SearchText" name="SearchText" type="text" />
        </td>
        <td>
            <input type="submit" value="Apply" />
        </td>
    </tr>
</table>
</fieldset>
}
<div class="items-grid">
    @ordersGrid.GetHtml(tableStyle: "webgrid",
                        headerStyle: "webgrid-header",
                        footerStyle: "webgrid-footer",
                        alternatingRowStyle: "webgrid-alternating-row",
                        selectedRowStyle: "webgrid-selected-row",
                        rowStyle: "webgrid-row-style",
                        mode: WebGridPagerModes.All,
                        firstText: "First",
                        lastText: "Last",
                        previousText: "Backward",
                        nextText: "Forward",
                        numericLinksCount: 5,
                        columns:
                        ordersGrid.Columns(
                            ordersGrid.Column("OrderNumber", "Order Number" ),
                            ordersGrid.Column("TotalPrice","Total Price"),
                            ordersGrid.Column("Discount", "Max Discount"),
                            ordersGrid.Column("DeliveryDate", "Delivery Date"),
                            ordersGrid.Column("Status", "Status"),
                            ordersGrid.Column("Assignee", "Assignee"),
                           // ordersGrid.Column("Role"),
                                    ordersGrid.Column("Edit", canSort: false, format: (item) => Html.ActionLink("Edit", "Edit", new { orderID = item.OrderID }, new { @class = "webridUserEdit" })),
                                    ordersGrid.Column("Delete", canSort: false, format: (item) => Html.ActionLink("Delete", "Delete", new { orderID = item.OrderID }, new { @class = "webridUserRemove" }))))
</div>